#ifndef __STATIC_COMPONENT_LOADER_H__
#define __STATIC_COMPONENT_LOADER_H__

#include "omxcore.h"
//#include "omx_resource_management.h"

//#define USE_RESOURCE_MANAGEMENT

/** @brief the private data structure handled by the ST static loader that described
 * an openMAX component
 *
 * This structure contains all the fields that the loader must use to support
 * the loading  unloading functions of the component, that are not described by the
 * standard.
 */
typedef struct OmxWinLoaderComponentType
{
    OMX_VERSIONTYPE componentVersion; /**< the version of the component in the OpenMAX standard format */
    char *name; /**< String that represents the name of the component, ruled by the standard */
    int name_specific_length; /**< this field contains the number of roles of the component */
    char **name_specific; /**< Strings those represent the names of the specific format components */
    char **role_specific; /**< Strings those represent the names of the specific format components */
    char *name_requested; /**< This parameter is used to send to the component the string requested by the IL Client */
    OMX_ERRORTYPE(*constructor)(OMX_COMPONENTTYPE *, OMX_STRING cComponentName); /**< constructor function pointer for each Linux ST OpenMAX component */

#ifdef USE_RESOURCE_MANAGEMENT
    OMX_BOOL bActive;
    ComponentEntitiesQueue sComEntitiesQueue;
#endif
} OmxWinLoaderComponentType;

/** @brief The initialization of the OmxWin specific component loader.
 */
void OmxWin_static_InitComponentLoader();

/** @brief The constructor of the ST specific component loader.
 *
 * It is the component loader developed under linux by ST, for local libraries.
 * It is based on a registry file, like in the case of Gstreamer. It reads the
 * registry file, and allows the components to register themself to the
 * main list templateList.
 */
OMX_ERRORTYPE BOSA_OmxWin_InitComponentLoader(BOSA_COMPONENTLOADER *loader);

/** @brief The destructor of the ST specific component loader.
 *
 * This function deallocates the list of available components.
 */
OMX_ERRORTYPE BOSA_OmxWin_DeInitComponentLoader(BOSA_COMPONENTLOADER *loader);

/** @brief creator of the requested openmax component
 *
 * This function searches for the requested component in the internal list.
 * If the component is found, its constructor is called,
 * and the standard callback are assigned.
 * A pointer to a standard openmax component is returned.
 */
OMX_ERRORTYPE BOSA_OmxWin_CreateComponent(BOSA_COMPONENTLOADER *loader, OMX_HANDLETYPE *pHandle, OMX_STRING cComponentName, OMX_PTR pAppData, OMX_CALLBACKTYPE *pCallBacks);

/** @brief destructor of the requested openmax component
 *
 */
OMX_ERRORTYPE BOSA_OmxWin_DestroyComponent(BOSA_COMPONENTLOADER *loader, OMX_HANDLETYPE hComponent);

/** @brief This function search for the index from 0 to end of the list
 *
 * This function searches in the list of ST static components and enumerates
 * both the class names and the role specific components.
 */
OMX_ERRORTYPE BOSA_OmxWin_ComponentNameEnum(BOSA_COMPONENTLOADER *loader, OMX_STRING cComponentName, OMX_U32 nNameLength, OMX_U32 nIndex);

/** @brief The specific version of OMX_GetRolesOfComponent
 *
 * This function replicates exactly the behavior of the
 * standard OMX_GetRolesOfComponent function for the ST static
 * component loader
 */
OMX_ERRORTYPE BOSA_OmxWin_GetRolesOfComponent(BOSA_COMPONENTLOADER *loader, OMX_STRING compName, OMX_U32 *pNumRoles, OMX_U8 **roles);

/** @brief The specific version of OMX_GetComponentsOfRole
 *
 * This function replicates exactly the behavior of the
 * standard OMX_GetComponentsOfRole function for the ST static
 * component loader
 */
OMX_ERRORTYPE BOSA_OmxWin_GetComponentsOfRole(BOSA_COMPONENTLOADER *loader, OMX_STRING role, OMX_U32 *pNumComps, OMX_U8 **compNames);

#endif
